<html>
<head><meta charset="utf-8"><title>default async · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html">default async</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="231040528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231040528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231040528">(Mar 19 2021 at 15:23)</a>:</h4>
<p>In a recent github comment, Niko wrote "I am thinking a lot about whether async Rust should be "the default" or not when it comes to I/O"</p>
<p>I'm curious what types of I/O might be default async (if that ever becomes a thing).   I/O to stdin/stdout?   File I/O?    Network I/O?</p>



<a name="231040727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231040727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231040727">(Mar 19 2021 at 15:25)</a>:</h4>
<p>i think most people would think that async for writing to stdout is probably overkill.  but could we envision a future where async in rust is Just So Easy that doing async for stdout writes by default becomes conceivable?</p>



<a name="231040851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231040851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Frederik Baetens <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231040851">(Mar 19 2021 at 15:25)</a>:</h4>
<p>I suppose it would be most IO that has a bit of latency associated with it, so that would be file I/O and Network I/O, stdin/stdout is something that's handled entirely on the cpu and memory, so there's not much need for async.</p>



<a name="231041168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231041168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231041168">(Mar 19 2021 at 15:28)</a>:</h4>
<p>writing to stdout can, at least in theory, block for extended periods of time</p>



<a name="231041307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231041307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Chin (eminence) <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231041307">(Mar 19 2021 at 15:29)</a>:</h4>
<p>(i sometimes hit the XOFF command in tmux by accident, and then wonder why nothing seems to be working :))</p>



<a name="231056055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231056055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231056055">(Mar 19 2021 at 17:02)</a>:</h4>
<p>I'm imagining a world where yes, the default is something like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">async</span><span class="w"> </span><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="fm">println!</span><span class="p">(</span><span class="s">"Hello, world!"</span><span class="p">).</span><span class="k">await</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="231056063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231056063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231056063">(Mar 19 2021 at 17:02)</a>:</h4>
<p>I'm not sure that world makes any sense</p>



<a name="231056073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231056073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231056073">(Mar 19 2021 at 17:02)</a>:</h4>
<p>that's certainly one extreme though :)</p>



<a name="231315350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231315350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231315350">(Mar 22 2021 at 14:06)</a>:</h4>
<p>There's also the question of whether the sync std is a wrapper around the async, to avoid duplication.</p>



<a name="231315396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231315396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231315396">(Mar 22 2021 at 14:06)</a>:</h4>
<p>If we could do that without overhead.</p>



<a name="231315646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/default%20async/near/231315646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/default.20async.html#231315646">(Mar 22 2021 at 14:08)</a>:</h4>
<p>Ideally, with some approaches to async, that would actually be <em>faster</em> than a purely sync approach.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>